<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <link rel="icon" type="image/x-icon" th:href="${application.iconPath}" />
    <title>代码引擎</title>
    <div th:include="../templates/aaacommon/basic::html_header"></div>


    <link th:href="@{{path}/lib/bootstrap-3.3.7-dist/css/bootstrap.min.css(path=${application.resource})}" rel="stylesheet"/>
    <script th:src="@{{path}//lib/bootstrap-3.3.7-dist/js/bootstrap.min.js(path=${application.resource})}"></script>

    <script type="text/javascript" th:src="@{{path}/lib/zclip/jquery.zclip.min.js(path=${application.resource})}"></script>

    <style type="text/css">
        .con_div {
            border: solid 1px #CCC;
            padding-left: 5px;
            padding-top: 10px;;
            padding-bottom: 10px;
        }

        .left_ul li {
            margin-top: 5px;
        }

        .input-width {
            width: 90%;
        }

        .delete_img {
            width: 30px;
            height: 30px;
            cursor: pointer;
        }

        .liInfo {
            border: solid 1px #CCC;
            margin-top: 10px;
            padding: 10px;
            height: auto;
        }

        .liInfo_div {
            border: solid 1px #CCC;
            padding: 10px;
            margin-top: 10px;
            height: auto;
            background-color: #F5F5F5;
        }

        .copyCode {
            cursor: pointer;
            margin-top: 5px;
        }

        .bgclor {
            background-color: #dff0d8;
        }
    </style>
</head>
<body>
<!--<div class="layui-container">-->
<div class="layui-fluid layui-form">
    <div class="layui-row  layui-col-space10">
        <div class="layui-col-md3 layui-col-lg3">
            <div class="con_div">
                <p>
                    <input type="text" class="layui-input input-width" id="searchTableText" placeholder="输入表名或注释"/>
                </p>
                <div id="left_tables">数据表格加载中...</div>
            </div>
        </div>
        <div class="layui-col-md9 layui-col-lg9">
            <form th:action="@{/db/generate.do}" method="post" name="basicForm" id="basicForm" target="_blank">
                <input type="hidden" th:value="${session.dbinfo.db_driver }" name="db_driver"/>
                <input type="hidden" th:value="${session.dbinfo.db_url }" name="db_url"/>
                <input type="hidden" th:value="${session.dbinfo.db_name }" name="db_name"/>
                <input type="hidden" th:value="${session.dbinfo.db_pwd }" name="db_pwd"/>

                <div class="con_div">
                    <table>
                        <tr>
                            <td>总包名</td>
                            <td><input type="text" class="layui-input input-width" name="basePackageName"/></td>
                            <td>author</td>
                            <td><input type="text" class="layui-input input-width" name="author"/></td>
                            <td>模板</td>
                            <td>
                                <select name="fk_type" class="input-width" id="fk_type" lay-verify="">
                                    <option th:each="t:${session.themes}" th:value='${t }' th:text="${t }"></option>
                                </select>
                            </td>
                            <td>&nbsp;&nbsp;&nbsp;
                                <button type="button" class="layui-btn layui-btn-normal" id="sub">提交</button>
                                <button type="button" id="yulan" class="layui-btn">预览</button>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="con_div" style="margin-top: 10px;">
                    <table id="table_list_id" class="layui-table" lay-even lay-skin="line row">
                        <thead>
                        <tr>
                            <th width="70">操作</th>
                            <th>表名</th>
                            <th>类名</th>
                            <th>总包名</th>
                            <th width="70">page</th>
                            <th width="70">新增</th>
                            <th width="70">删除</th>
                            <th width="70">修改</th>
                            <th width="70">查询所有</th>
                            <th width="70">分页查询</th>
                            <th width="70">查询单个</th>
                        </tr>
                        </thead>
                        <tbody id="table_body"></tbody>
                    </table>
                </div>
            </form>
        </div>
    </div>

</div>
<!--模板-->
<script id="left_tables_tpl" type="text/html">
    <p>请选择表,一共{{ d.length }}条数据</p>
    <ul class="left_ul">
        {{# layui.each(d, function(index, item){ }}
        <li>
            <span><b><input type="checkbox" lay-skin="primary" lay-filter="table_checkbox"
                         value="{{ item.tableName }}" title="{{ item.comment }}&nbsp;&nbsp;{{ item.tableName }}"/>
                </b>
            <input type="button" value=" detail " class="layui-btn layui-btn-primary layui-btn-xs tableDetail"
                   name="{{ item.tableName }}" data-toggle="modal" data-target="#myModal"/>
                <input type="hidden" value="{{ item.comment }}"/>
            </span>
        </li>
        {{# }); }}
    </ul>
    <div style="height: 20px;"></div>
</script>
<script id="tr_id" type="text/html">
    <tr id="tr_{{d.tableName}}">
        <td>
            <img class="delete_img" title="删除{{d.tableName}}" value="{{d.tableName}}"
                 th:src="@{{path}/istyle/images/dele.png(path=${application.basePath}) }"/>
            <input type="hidden" value="{{d.tableName}}" class="tableName" name=""/>
        </td>
        <td><b>{{d.tableName}}</b></td>
        <td><input type="text" class="layui-input className" name="" value="{{d.className}}"/></td>
        <td><input type="text" class="layui-input packageName" name="" value="{{d.packageName}}"/></td>
        <td><input type="checkbox" checked="checked" class="page" name="" lay-skin="primary"/></td>
        <td><input type="checkbox" checked="checked" class="add" name="" lay-skin="primary"/></td>
        <td><input type="checkbox" checked="checked" class="delete" name="" lay-skin="primary"/></td>
        <td><input type="checkbox" checked="checked" class="update" name="" lay-skin="primary"/></td>
        <td><input type="checkbox" checked="checked" class="selectList" name="" lay-skin="primary"/></td>
        <td><input type="checkbox" checked="checked" class="selectPage" name="" lay-skin="primary"/></td>
        <td><input type="checkbox" checked="checked" class="select" name="" lay-skin="primary"/></td>
        <input type="hidden" class="comment" name="" value="{{d.comment}}"/>
    </tr>
</script>


<!--弹出层, 模块框-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">
                    <label id="lableTableInfo"></label>
                </h4>
            </div>
            <div class="modal-body">
                <ul class="nav nav-tabs" id="headerInfo">
                    <li class="li active"><a onclick="void(0)">表字段</a></li>
                    <input type="hidden" value="fieldInfo"/>
                    <li class="li"><a onclick="void(0)">查询sql</a></li>
                    <input type="hidden" value="sqlInfo"/>
                    <li class="li"><a onclick="void(0)">文档</a></li>
                    <input type="hidden" value="docInfo"/>
                </ul>
                <div id="fieldInfo" class="liInfo"></div>
                <div id="sqlInfo" class="liInfo">
                    <input id="table_as_name" placeholder="  表的别名"/>
                    <div class="liInfo_div" id="liInfo_div1"></div>
                    <!-- <button type="button" class="btn btn-info btn-xs" id="copeCode" name="liInfo_div1">复制上面的代码</button> -->
                    <div class="liInfo_div" id="liInfo_div2"></div>
                    <!-- <button type="button" class="btn btn-info btn-xs copyCode" name="liInfo_div2">复制上面的代码</button> -->
                </div>
                <div id="docInfo" class="liInfo">
                    <div class="liInfo_div" id="liInfo_div3"></div>
                </div>
            </div>
        </div>

    </div>
</div>
</body>
</html>
<script th:src="@{{path}/istyle/js/select.js(path=${application.basePath}) }" type="text/javascript" charset="utf-8"></script>